package com.uco.thread;

public class Create01 {
    public static void main(String[] args) {
        Thread mt = new MyThread();
        mt.start();

        Thread mt1 = new Thread(new MyThread1());
        mt1.start();

    }
}

// 创建线程的方法一：继承Thread类
// 优点：线程创建简单，继承Thread类，并重写run()方法
// 缺点：创建线程需要继承Thread类，并且实现run()方法，代码冗余，且通过继承实现，类功能单一

class MyThread extends Thread {
    @Override
    public void run()
    {
        for (int i = 0; i < 10 ; i++) {
            System.out.println("MyThread is running :" + i );
        }
    }
}